Skip to content

Fix cache invalidation for module binaries#6914

Open
FloWuenne wants to merge 1 commit into
nextflow-io:masterfrom
FloWuenne:codex/fix-module-binaries-wave-cache
Open

Fix cache invalidation for module binaries#6914
FloWuenne wants to merge 1 commit into
nextflow-io:masterfrom
FloWuenne:codex/fix-module-binaries-wave-cache

Conversation

@FloWuenne

Copy link
Copy Markdown
Contributor

Summary

Fix task cache invalidation when using module binaries with Wave.

Task hashing previously considered project-level bin/ scripts but not module-level binaries under resources/usr/bin, which could cause stale cached tasks to be reused after a module binary changed.

This change makes task hashing resolve referenced executables from the task bin paths, including module binary directories, so module binary updates invalidate the cache as expected.

Closes #6128

Testing

  • Added a regression test for module binary hash changes in TaskHasherTest
  • Ran:
    • ./gradlew :nextflow:test --tests 'nextflow.processor.TaskHasherTest'

@netlify

netlify Bot commented Mar 12, 2026

Copy link
Copy Markdown

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 0914b92
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/69b330aebed51d0008ac8264

@pditommaso

Copy link
Copy Markdown
Member

Can you provide a reproducible test case for the problem are aiming to solve.

Module resources/bins are included via the container fingerprint, see here and here and here

@FloWuenne

FloWuenne commented Mar 13, 2026

Copy link
Copy Markdown
Contributor Author

From the issue referenced #6128, someone wrote a minimal test pipeline: jashapiro/nextflow-resume-test.

We can test this fix using the following procedure:

git clone https://github.com/jashapiro/nextflow-resume-test.git
cd nextflow-resume-test

Run once:

nextflow run . -c inspect-wave.config -with-docker

where inspect-wave.config is:

wave.enabled = true
process.container = 'community.wave.seqera.io/library/samtools:1.21--0d76da7c3cf7751c'
nextflow.enable.moduleBinaries = true

Change the module binary and rerun with resume:

touch modules/test/resources/usr/bin/hello_test.sh
nextflow run . -c inspect-wave.config -with-docker -resume

Expected result with the fix:

Cached process > hello
Submitted process > test:test_hello

Before the fix, both processes could be restored from cache even after changing modules/test/resources/usr/bin/hello_test.sh.

The included groovy test in the PR should emulate the same behaviour. I have tested the fix using a local build of Nextflow with these changes and that worked.

@pditommaso Do you prefer the fix implementation via a different mechanism? If so, can you elaborate how?

@pditommaso

Copy link
Copy Markdown
Member

If am i not wrong the test does not use wave https://github.com/jashapiro/nextflow-resume-test

@pditommaso

Copy link
Copy Markdown
Member

Ok, managed to replicate:

  • execution with wave: ok ✅
  • execution without wave: module res changes are not detected ❌

@FloWuenne

Copy link
Copy Markdown
Contributor Author

@pditommaso Thanks for replicating! Anything else missing to get this merged?

@pditommaso

Copy link
Copy Markdown
Member

Yes, this PR requires merging this first #6927

@ronp-cytoreason-com

Copy link
Copy Markdown

hey, are we planning to merge this at any time?
is it fixed on newer versions?

@bentsherman

Copy link
Copy Markdown
Member

Since we decided not to merge #6927 , I think we should go ahead and fix this issue. However I need to review this issue again and make sure this fix is the right fix

@bentsherman
bentsherman self-requested a review July 14, 2026 14:12
When a module uses local binaries via its `resources/` directory
(the `nextflow.enable.moduleBinaries` feature flag), those files were
not part of the task hash used for `-resume` caching. As a result,
editing a module's `resources` script did not invalidate the cache and
`-resume` returned a stale cached result instead of re-executing the
task.

Add the module resources bundle fingerprint to the task hash key list
in `TaskHasher.compute()`, guarded by `session.enableModuleBinaries()`
(matching the existing guard in `TaskProcessor.getBinDirs()`), so edits
to module binaries correctly force task re-execution while unchanged
resources still hit the cache.

Note: this does not affect Wave setups, where the resources are baked
into the container and already covered by the container fingerprint.

Fixes nextflow-io#6128

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
@bentsherman
bentsherman force-pushed the codex/fix-module-binaries-wave-cache branch from 0914b92 to 9e2e7eb Compare July 14, 2026 18:40
@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for nextflow-docs canceled.

Name Link
🔨 Latest commit 9e2e7eb
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs/deploys/6a5682a2015b780008fd3d23

@bentsherman bentsherman changed the title Fix cache invalidation for module binaries with Wave Fix cache invalidation for module binaries Jul 14, 2026

@bentsherman bentsherman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the original issue and updated the PR with my preferred implementation. It just adds the module resources to the task hash

This PR fixes the specific case of using module binaries without Wave on a shared filesystem

@bentsherman
bentsherman requested a review from pditommaso July 14, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

caching with module binaries files is not identifying changes

4 participants